home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 (Alt) / MACD 5.bin / workbench / tools / czesc_1 / cpdist / args.c next >
Encoding:
C/C++ Source or Header  |  1994-01-12  |  2.2 KB  |  77 lines

  1. /*
  2.  *  ARGS.C
  3.  */
  4.  
  5. /*
  6.  * (c)Copyright 1992-93 by Tobias Ferber.
  7.  *
  8.  * This file is part of CPDIST.
  9.  *
  10.  * CPDIST is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published
  12.  * by the Free Software Foundation; either version 1 of the License,
  13.  * or (at your option) any later version.
  14.  *
  15.  * CPDIST is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with CPDIST; see the file COPYING.  If not, write to
  22.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #include <string.h>
  26.  
  27. static char *howtouse[]= {
  28.   "-a", "--replace-all",      "don't ask before blowing files away",
  29.   "-a", "--assume-replace",   "",
  30.   "-b", "--buffer-size",      "set the copy buffer size",
  31.   "-c", "--check-existence",  "look for files before copying anything",
  32.   "-D", "--key",              "make a distribution key valid",
  33.   "-E", "--stderr",           "redirect the error output",
  34.   "-f", "--file",             "use a certain 'distfile' filename",
  35.   "-h", "--help",             "display short usage information and exit",
  36.   "-i", "--ignore-errors",    "try to parse the 'distfile' completely",
  37.   "-k", "--keep-going",       "go on, even if in case of an I/O error",
  38.   "-n", "--just-print",       "don't copy anything, just print",
  39.   "-n", "--dry-run",          "",
  40.   "-n", "--recon",            "",
  41.   "-s", "--silent",           "don't print filenames when copying",
  42.   "-s", "--quiet",            "",
  43.   "-v", "--version",          "display author and version information",
  44.   (char *)0L, (char *)0L
  45. };
  46.  
  47. /* Note that this way of transforming options does not take care of the
  48.  * OPTION_PREFIX which is defined in 'cpdist.h'.
  49.  * This may change in future revisions.
  50.  */
  51.  
  52. char *
  53. convert_args(s)
  54. char *s;
  55. {
  56.   char **t= howtouse;
  57.  
  58.   while(*t)
  59.   { if(!strcmp(s,t[1]))
  60.       break;
  61.     t= &t[3];
  62.   }
  63.  
  64.   return (*t) ? *t : s;
  65. }
  66.  
  67. void display_args(void)
  68. {
  69.   char **t= howtouse;
  70.  
  71.   while(*t)
  72.   { if(t[2] && *t[2])
  73.       printf("%s or %-20s %s\n",t[0],t[1],t[2]);
  74.     t= &t[3];
  75.   }
  76. }
  77.